package com.neoCalf.neoCommon.exception;

import com.neoCalf.neoCommon.enums.ResultCode;
import lombok.Getter;


@Getter
public class BusinessException extends RuntimeException {
    private final ResultCode resultCode;

    public BusinessException(ResultCode codeEnum) {
        super(codeEnum.getMsg());
        this.resultCode = codeEnum;
    }

    public BusinessException(ResultCode codeEnum, String msg) {
        super(msg);
        codeEnum.setMsg(msg);
        this.resultCode = codeEnum;
    }

    /**
     * 重写fillInStackTrace 业务异常不需要堆栈信息，提高效率
     */
    @Override
    public synchronized Throwable fillInStackTrace() {
        return this;
    }
}